<%@ page language="java" pageEncoding="UTF-8"%>
<script type="text/javascript">
	$(function() {
		// 初始化小计
		var examScore = $('#student_gradeEdit_examScoreText').val();
		var homeworkScore = $('#student_gradeEdit_homeworkScoreText').val();
		var attendanceScore = $('#student_gradeEdit_attendanceScoreText').val();
		var sumScore = parseFloat(examScore) + parseFloat(homeworkScore) + parseFloat(attendanceScore);
		$('#student_gradeEdit_sumScoreText').val(sumScore);

		// 考试成绩
		$('#student_gradeEdit_examScoreText').blur(function() {
			var examScore = $('#student_gradeEdit_examScoreText').val();
			var homeworkScore = $('#student_gradeEdit_homeworkScoreText').val();
			var attendanceScore = $('#student_gradeEdit_attendanceScoreText').val();
			var sumScoreText = parseFloat(examScore) + parseFloat(homeworkScore) + parseFloat(attendanceScore);
			$('#student_gradeEdit_sumScoreText').val(sumScoreText);
		});

		// 作业成绩
		$('#student_gradeEdit_homeworkScoreText').blur(function() {
			var examScore = $('#student_gradeEdit_examScoreText').val();
			var homeworkScore = $('#student_gradeEdit_homeworkScoreText').val();
			var attendanceScore = $('#student_gradeEdit_attendanceScoreText').val();
			var sumScore = parseFloat(examScore) + parseFloat(homeworkScore) + parseFloat(attendanceScore);
			$('#student_gradeEdit_sumScoreText').val(sumScore);
		});

		// 出勤成绩
		$('#student_gradeEdit_attendanceScoreText').blur(function() {
			var examScore = $('#student_gradeEdit_examScoreText').val();
			var homeworkScore = $('#student_gradeEdit_homeworkScoreText').val();
			var attendanceScore = $('#student_gradeEdit_attendanceScoreText').val();
			var sumScore = parseFloat(examScore) + parseFloat(homeworkScore) + parseFloat(attendanceScore);
			$('#student_gradeEdit_sumScoreText').val(sumScore);
		});

		// 小计成绩
		$('#student_gradeEdit_sumScoreText').blur(function() {
			var examScore = $('#student_gradeEdit_examScoreText').val();
			var homeworkScore = $('#student_gradeEdit_homeworkScoreText').val();
			var attendanceScore = $('#student_gradeEdit_attendanceScoreText').val();
			var sumScore = parseFloat(examScore) + parseFloat(homeworkScore) + parseFloat(attendanceScore);
			$('#student_gradeEdit_sumScoreText').val(sumScore);
		});

		$('#student_gradeEdit_courseCombobox').combobox({
			valueField : 'id',
			textField : 'courseName',
			editable : false,
			onSelect : function(rec) {
				$('#student_gradeEdit_editGradeForm input[name=courseId]').val(rec.id);
			}
		});

	});
</script>
<form id="student_gradeEdit_editGradeForm" method="post">
	<table>
		<tr>
			<td style="text-align: right;">学生：</td>
			<td><input name="studentName" readonly="readonly" /></td>
		</tr>
		<tr>
			<td style="text-align: right;">学号：</td>
			<td><input name="studentNo" readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">课程名称：</td>
			<td><input id="student_gradeEdit_courseCombobox" name="courseName" class="easyui-combobox" data-options="required:true,missingMessage:'必填项'" style="width:220px;" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">考试成绩：</td>
			<td><input id="student_gradeEdit_examScoreText" name="examScore" value="0" class="easyui-numberbox" data-options="min:0,precision:1" style="width:220px;" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">作业成绩：</td>
			<td><input id="student_gradeEdit_homeworkScoreText" name="homeworkScore" value="0" class="easyui-numberbox" data-options="min:0,precision:1" style="width:220px;" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">出勤成绩：</td>
			<td><input id="student_gradeEdit_attendanceScoreText" name="attendanceScore" value="0" class="easyui-numberbox" data-options="min:0,precision:1" style="width:220px;" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">小计：</td>
			<td><input id="student_gradeEdit_sumScoreText" name="sumScore" style="width:220px;" value="0" class="easyui-numberbox" data-options="min:0,precision:1" readonly="readonly" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">综合成绩：</td>
			<td><input name="overallScore" style="width:220px;" class="easyui-validatebox" data-options="required:true,missingMessage:'必填项'" />
			</td>
		</tr>
		<tr>
			<td style="text-align: right;">备注：</td>
			<td><textarea name="memo" style="width:220px;"></textarea>
			</td>
		</tr>
	</table>
	<input name="studentId" type="hidden" /> <input name="courseId" type="hidden" /> <input name="id" type="hidden" />
</form>